package cn.starrysky108.simpleerp.core.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author Carl Lee
 */
@Data
@ConfigurationProperties(prefix = "simpleerp")
public class SimpleErpProperties {

    /**
     * 定义密钥
     */
    private String secretKey;
    /**
     * 上传文件保存位置，使用绝对路径
     */
    private String uploadDir = "static/uploads";
    /**
     * 文件上传服务器地址,默认为http://simpleerp.host:server.port/uploads/
     */
    private String uploadServer;
    /**
     * 主机ip地址,必须设置
     */
    private String host = "127.0.0.1";

    /**
     * 是否开启shiro登录验证
     */
    private Boolean enableShiroAuth = true;
    /**
     * 是否开启自动填充
     */
    private Boolean enableAutoFill = true;
    /**
     * 是否开启Swagger
     */

    private Boolean enableSwagger = true;
    /**
     * jwt配置
     */
    private final JwtProperties jwt = new JwtProperties();
    /**
     * 默认redis缓存失效时间,单位：天，默认30
     */
    private final int cacheExpireTime = 30;

    public static class JwtProperties {

        /**
         * 私钥
         */
        private String secret = "U2FsdGVkX1+4FjUVLWTYdAcqkobychxAvLWmJynqm8bVA9LvUwG4m43XmB0Hv00L";
        /**
         * accessToken 过期时间默认为30分钟，单位分钟
         */
        private long accessTokenExpireTime = 30;
        /**
         * refreshToken 过期时间默认为1个月，单位分钟
         */
        private long refreshTokenTokenExpireTime = 30 * 24 * 60;

        public String getSecret() {
            return secret;
        }

        public void setSecret(String secret) {
            this.secret = secret;
        }

        public long getAccessTokenExpireTime() {
            return accessTokenExpireTime;
        }

        public void setAccessTokenExpireTime(long accessTokenExpireTime) {
            this.accessTokenExpireTime = accessTokenExpireTime;
        }

        public long getRefreshTokenTokenExpireTime() {
            return refreshTokenTokenExpireTime;
        }

        public void setRefreshTokenTokenExpireTime(long refreshTokenTokenExpireTime) {
            this.refreshTokenTokenExpireTime = refreshTokenTokenExpireTime;
        }
    }

}
